<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" charset="utf-8">
			//间隔定时器
			var timer1=setInterval(function(){
				console.log('1000毫秒过去了')
			},1000)
			
			//延时定时器
			var timer2=setTimeout(function(){
					console.log('延时1s执行setTimeout函数')
			},1000)
			
			//输出定时器的返回值:返回值的意义为:定时器的编号
			console.log("timer1:"+timer1)//1
			console.log("timer2:"+timer2)//2
			
			//关闭定时器,输入参数为定时器编号，即定时器函数返回值
			close.onclick=function(){
				clearInterval(1)
				clearInterval(2)
				console.log('定时器已关闭')
			}

			
		</script>
	</head>
	<body>
		<button type="button" id="close" >点击关闭定时器</button>
	</body>
</html>
